package com.hyg.module_third_party_demo.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.facade.service.SerializationService;
import com.alibaba.android.arouter.launcher.ARouter;
import com.hyg.lib_common.Base.BaseActivity;
import com.hyg.lib_common.constant.Constants;
import com.hyg.module_third_party_demo.R;
import com.hyg.module_third_party_demo.entity.User;
import com.hyg.module_third_party_demo.litepal.DataModule.Option;

@Route(path = Constants.PATH_ACTIVITY_MODULE_DEMO_AROUTER_NEXT)
public class ArouterNextActivity extends BaseActivity {
    int type = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_arouter_next);
        init();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }


    /**
     * @description 传递参数获取
     * @author visitant
     * @time 2020/11/13 16:40
     */
    public void init() {
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("type=" + getIntent().getExtras().getLong("type", 2) + "\n");
        stringBuffer.append("params=" + getIntent().getExtras().getBundle("params").getString("name") + "\n");
        SerializationService serializationService = ARouter.getInstance().navigation(SerializationService.class);
        serializationService.init(this);
        User user = serializationService.parseObject(getIntent().getExtras().getString("object"), User.class);
        stringBuffer.append("params user name=" + user.getName());
        TextView textView = findViewById(R.id.show_msg_tv);
        textView.setText(stringBuffer.toString());
    }

    @Override
    public void finish() {
        super.finish();
    }

    public void onBack(View view) {
        finish();
    }

}